package com.ys.filelib.filedialog.entity;

import org.apache.commons.net.ftp.FTPFile;

public class FTPFileBean {

    public FTPFile file;
    public String parent;
    public String host;
    public String username;
    public int port;
    public boolean check;

    public FTPFileBean() {

    }

    public FTPFileBean(FTPFile file, String parent, String host, int port, String username) {
        this.file = file;
        this.parent = parent;
        this.host = host;
        this.port = port;
        this.username = username;
    }

    public String getPath() {
        if (parent.endsWith("/")) {
            return parent + file.getName();
        }
        if ("/".equals(file.getName())) {
            return file.getName();
        }
        return parent + "/" + file.getName();
    }

    public long getSize() {
        return file.getSize();
    }

    public String getName() {
        return file.getName();
    }

    public boolean isDirectory() {
        return file.isDirectory();
    }

    public long getCreateTime() {
        return file.getTimestamp().getTimeInMillis();
    }
}
